package com.lixh.roommanager.ui

import android.content.res.Resources
import android.util.Log
import android.util.TypedValue
import org.joda.time.DateTime
import org.joda.time.DateTimeZone
import org.joda.time.LocalDate
import java.util.*

val Float.dp
    get() = TypedValue.applyDimension(
        TypedValue.COMPLEX_UNIT_DIP,
        this,
        Resources.getSystem().displayMetrics
    )


val Long.YMD
    get() = DateTime(
        this,
        DateTimeZone.forTimeZone(TimeZone.getTimeZone("GMT+8:00"))
    ).toString("yyyy-MM-dd")


val Long.YMD_HS
    get() = DateTime(
        this,
        DateTimeZone.forTimeZone(TimeZone.getTimeZone("GMT+8:00"))
    ).toString("yyyy-MM-dd HH:mm:ss")

fun String.plusDays(day: Int): String {
    return LocalDate(this).plusDays(day).toString()
}

val String.LOG
    get() = Log.e("DEBUG", this)

object Constant {
    var TIME_TYPE: Int = 0
    const val JSON_ROOM: String = "json_room"

}